/**
 * related to toOrderItemCell.ui
 * 
 * @Author : chenglm
 * @Timestamp : 2016-10-10
 */
var root = ui("$");
var page = sm("do_Page");
var aLayout_checkbox = ui("aLayout_checkbox");
var checkedImage = ui("checkbox");
var label_itemName = ui("label_itemName");

root.setMapping({
	"checkbox.source" : "checked",
	"checkbox.tag" : "id",
	"label_itemName.text" : "name",
	"label_itemName.fontColor" : "fontColor",
	"label_itemName.tag" : "index"
});

aLayout_checkbox.on("touch", function() {
	if (checkedImage.source == deviceone.checked) {
		checkedImage.source = deviceone.unchecked;
		label_itemName.fontColor = "313131FF";
	} else {
		checkedImage.source = deviceone.checked;
		label_itemName.fontColor = "FF7E00FF";
	}
	fireMyItem();
});

function fireMyItem() {
	var d = {
		"index" : label_itemName.tag,
		"itemName":label_itemName.text,
		"checked" : checkedImage.source,
		"fontColor" : label_itemName.fontColor
	};
	page.fire("myItem", d);
}